package com.sinog.alarm.service.impl;

import com.sinog.alarm.mapper.db1.DepartmentSystemCodeMapper;
import com.sinog.alarm.mapper.db1.DepartmentUserMapper;
import com.sinog.alarm.mapper.db1.UserAuthMapper;
import com.sinog.alarm.mapper.db1.UserSystemCodeMapper;
import com.sinog.alarm.model.LocalCode;
import com.sinog.alarm.model.SystemCode;
import com.sinog.alarm.service.AlarmReasonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;

/**
 * @desc 扫描省份基础表中的数据警告信息
 * @author lk
 * @date 2022-02-17 14:19
 */
@Service
public class AlarmReasonServiceImpl implements AlarmReasonService {

    @Autowired
    private DepartmentSystemCodeMapper departmentSystemCodeMapper;
    @Autowired
    private DepartmentUserMapper departmentUserMapper;
    @Autowired
    private UserAuthMapper userAuthMapper;
    @Autowired
    private UserSystemCodeMapper userSystemCodeMapper;
    @Autowired
    private LocalCode localCode;

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findDepartmentNotHaveUser() {
        return departmentUserMapper.findDepartmentNotHaveUser();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findUserNotHaveDepartment() {
        return departmentUserMapper.findUserNotHaveDepartment();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findDepartmentNotHaveSystemCode() {
        return departmentSystemCodeMapper.findDepartmentNotHaveSystemCode(localCode);
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findSystemCodeNotHaveDepartment() {
        return departmentSystemCodeMapper.findSystemCodeNotHaveDepartment(localCode);
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findUserNotHaveSystemCode() {
        return userSystemCodeMapper.findUserNotHaveSystemCode();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findSystemCodeNotHaveUser() {
        return userSystemCodeMapper.findSystemCodeNotHaveUser(localCode);
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findSystemCodeNotHaveAuthUser() {
        return userAuthMapper.findSystemCodeNotHaveAuthUser();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findAuthUserNotHaveSystemCode() {
        return userAuthMapper.findAuthUserNotHaveSystemCode();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> systemCodeAuthUserCount() {
        Integer systemCodeCount = userAuthMapper.systemCodeCount();
        Integer authUserCount = userAuthMapper.authUserCount();
        SystemCode systemCode = new SystemCode();
        systemCode.setCodeId("tbsys_user数量:" + systemCodeCount.toString());
        systemCode.setPcodeId("auth_user数量:" + authUserCount.toString());
        systemCode.setCodeName("字典表和用户表");
        List<SystemCode> systemCodes = new ArrayList<>();
        systemCodes.add(systemCode);
        return systemCodes;
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findDisabledSystemCode() {
        return userAuthMapper.findDisabledSystemCode();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> findDisabledAuthUser() {
        return userAuthMapper.findDisabledAuthUser();
    }

    /**
     * 描述
     * @return List<SystemCode>
     */
    @Override
    public List<SystemCode> departmentInconsistentUser() {
        return departmentUserMapper.departmentInconsistentUser();
    }
}